//
//  String+AppInfo.swift
//  yiplayer
//
//  Created by cgw on 2024/6/26.
//

import Foundation

extension String{
    static func appName() -> String?{
        //先从infoPlist.strings本地化文件中，取app名字，若无，在从plist中取
        let appName = NSLocalizedString("CFBundleDisplayName", tableName: "infoPlist", comment: "")
        
        if appName == "CFBundleDisplayName" {
            if let dic = Bundle.main.infoDictionary {
                var na = dic["CFBundleDisplayName"] as? String
                if na == nil {
                    na = dic["CFBundleName"] as? String
                }
                return na
            }
            return nil
        }
        return appName
    }
        
    static func appVersion() -> String?{
        if let dic = Bundle.main.infoDictionary {
            var na = dic["CFBundleShortVersionString"] as? String
            return na
        }
        return nil 
    }
}
